package com.foreverwin.mes.production.service.impl;

import com.foreverwin.mes.core.base.FrontPage;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.foreverwin.mes.production.model.MaterialConsumption;
import com.foreverwin.mes.production.mapper.MaterialConsumptionMapper;
import com.foreverwin.mes.production.service.MaterialConsumptionService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 * 物料耗用 服务实现类
 * </p>
 *
 * @author Ervin Chen
 * @since 2020-03-11
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MaterialConsumptionServiceImpl extends ServiceImpl<MaterialConsumptionMapper, MaterialConsumption> implements MaterialConsumptionService {


    @Autowired
    private MaterialConsumptionMapper materialConsumptionMapper;

    @Override
    public Page<MaterialConsumption> selectPage(FrontPage<MaterialConsumption> frontPage, MaterialConsumption materialConsumption) {
        EntityWrapper<MaterialConsumption> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(materialConsumption);
        return super.selectPage(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<MaterialConsumption> selectList(MaterialConsumption materialConsumption) {
        EntityWrapper<MaterialConsumption> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(materialConsumption);
        return super.selectList(queryWrapper);
    }


}